Option Strict Off
Option Explicit On
Friend Class frmCollProps
	Inherits System.Windows.Forms.Form
	
	Public Sub Config(ByRef CollectionName As String, ByRef CollectionID As String)
		txtCollectionName.Text = CollectionName
		txtCollectionID.Text = CollectionID
	End Sub
	
	Private Sub cmdClose_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdClose.Click
		Me.Close()
	End Sub
	
	Private Sub cmdRefreshCollections_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdRefreshCollections.Click
		If txtCollectionID.Text = "COLLROOT" Then
			MsgBox("Can't display members of COLLROOT collection.", MsgBoxStyle.OKOnly, gstrAppTitle)
			Exit Sub
		End If
		On Error GoTo cmdRefreshCollectionserr
		'UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
		System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
		Dim objMembers As WbemScripting.SWbemObjectSet
		Dim objMember As WbemScripting.SWbemObject
		objMembers = frmMain.mobjConn.SMSServices.ExecQuery("Select Name from SMS_CM_RES_COLL_" & txtCollectionID.Text & " order by Name",  , WbemScripting.WbemFlagEnum.wbemFlagForwardOnly + WbemScripting.WbemFlagEnum.wbemFlagReturnImmediately)
		lstCollectionMembers.Items.Clear()
		
		lstCollectionMembers.Visible = False
		For	Each objMember In objMembers
			lstCollectionMembers.Items.Add(objMember.Properties_.Item("Name").Value)
		Next objMember
		lstCollectionMembers.Visible = True
		
		txtSystemCount.Text = CStr(lstCollectionMembers.Items.Count)
		
		'UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
		System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
		'UPGRADE_NOTE: Object objMembers may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'
		objMembers = Nothing
		Exit Sub
cmdRefreshCollectionserr: 
		lstCollectionMembers.Visible = True
		MsgBox("Error downloading collection members: " & Err.Description, MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, gstrAppTitle)
		'UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
		System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
		On Error GoTo 0
	End Sub
	
	Private Sub frmCollProps_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		lstCollectionMembers.Items.Add("Click refresh to download collection members...")
	End Sub
End Class